#include "ClassSection.h"

ClassSection::ClassSection(int num, Professor newProfessor, bool hasProf)
{
    this->number = num;
    this->professor = newProfessor;
    this->hasProf=hasProf;
}

ClassSection::ClassSection(int num)
{
    this->number = num;
    this->hasProf=true;
    this->professor=*(new Professor("TBA"));
}


//added by me
ClassSection::ClassSection()
{
    this->hasProf=true;
    this->professor=*(new Professor("TBA"));

}

int ClassSection::getNumber() const
{
    return number;
}

Professor ClassSection::getProfessor() const
{
    return professor;
}

bool ClassSection::getHasProf() const
{
    return this->hasProf;
}

void ClassSection::setNumber(int newNumber){
    this->number = newNumber;
}

void ClassSection::setProfessor(Professor newProfessor)
{
    this->professor = newProfessor;
    this->hasProf=true;
}

bool ClassSection::sectHasProf()
{
    return this->hasProf;
}

QDataStream &operator<<(QDataStream &out, const ClassSection &data)
{
   out << quint32(data.getNumber()) << data.getProfessor() << data.getHasProf();
   return out;
}

QDataStream &operator>>(QDataStream &in, ClassSection &data)
{
    quint32 number;
    Professor professor;
    bool hasProf;
    in >> number >> professor >> hasProf;
    data = ClassSection(number, professor, hasProf);
    return in;
}
